package com.wwj.study.rmi.demo.server;

import java.rmi.Naming;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;

public class ServerDemo {
    public static void main(String[] args) throws RemoteException {
        IHelloWorld helloWorld =new HelloWorldImpl();
        try {
            LocateRegistry.createRegistry(8888);
            Naming.rebind("rmi://127.0.0.1/sayHello",helloWorld); //注册中心 key - value
            System.out.println("服务启动成功");

        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}
